<style lang="less">
	@import "../../../assets/style/photo.less";
</style>

<template>
    <mxq-router-layout>
        <div class="photo">
            <Head slot="header" @headerClick="headerClick($event)">
                <div slot="headerTitle">
                    <span>{{title}}杆塔</span>
                </div>
                <div slot="headerRight">
                    <!--<span>导航</span>-->
                </div>
            </Head>
            <span class="iconBox">
                <img
                    class="iconRight"
                    src="../../../assets/img/changguixunshi/icon_rw.png"
                    alt=""
                    @click="receiveTask"
                >
                <em class="iconText">接受任务</em>
            </span>

            <!-- 拍照 start -->
            <!-- <take-photo
                :pohtoParam="pohtoParam"
                :photoLists="photoLists"
                :pohtoShow="pohtoShow"
                @quexian_data="initQuanxian"/> -->
            <!-- 拍照 end -->
            
            <van-row  @quexian_data="initQuanxian">
                <van-col class="col_item" span="24" v-for="(item,index) in photoLists" :key="index">
                    <p class="photo_item clearfix">
                        <label :for="item.title">{{item.title}}</label>
                        <span class="img_box clearfix">
                            <img :src="item.photoImg" alt="" style="width: 50px; float: left;" class="img_pho" @click="prompt">
                        </span>
                    </p>
                </van-col>
            </van-row>

            <van-row class="quexian_item">
                <van-col span="24">
                    <p class="photo_item tit_item clearfix">
                        <label for="架空线路缺陷核查"><em>*</em>架空线路缺陷核查</label>
                    </p>
                </van-col>
            </van-row>
        
            <!-- 八大线路缺陷 开始 -->
            <quexian-list
                :listLeftImg="listLeftImg" 
                :type_arr="type_arr"
                @quexianClick="quexianClick($event)"/>
            <!-- 八大线路缺陷 结束 -->
            <div class="btns">
                <van-tabbar>
                    <van-tabbar-item>
                        <van-button size="small" class="btn_l" @click="goYhList">隐患情况</van-button>
                    </van-tabbar-item>
                    <van-tabbar-item>
                        <van-button size="small" class="btn_r" @click="goClArea">测量记录</van-button>
                    </van-tabbar-item>
                </van-tabbar>
            </div>
        </div>
    </mxq-router-layout>
</template>

<script>
import Head from '../../../components/head'
import TakePhoto from '../../components/taskTake-photo'
// import photoImg from '../../../assets/img/changguixunshi/icon_dispho.png'
import iconHis from '../../../assets/img/changguixunshi/icon_histroy.png'
import QuexianList from '../../../components/quexian'
import { callData } from '../../../axios/axios'
import disPho from '../../../assets/img/changguixunshi/icon_dispho.png'

import {
    Row,
    Col,
    Tabbar,
	TabbarItem,
	Button,
	Dialog,
	Toast
} from 'vant';
export default {
    components: {
        Head,
        TakePhoto,
        QuexianList,
        [Row.name]: Row,
        [Col.name]: Col,
        [Tabbar.name]:Tabbar,
        [TabbarItem.name]:TabbarItem,
        [Button.name]:Button,
        [Dialog.name]:Dialog,
        [Toast.name]:Toast
    },
    data() {
        return {
        	title:this.$route.query.towerName,
            username: '',
            listLeftImg: [iconHis,iconHis,iconHis,iconHis,iconHis,iconHis,iconHis,iconHis,iconHis],
           /*  pohtoParam: {},
            pohtoShow: {
            	type: 'xljx',
            	img: false
            }, */
            photoLists: [           // 拍照目录
                {
                    title: "杆塔牌拍照",
                    photoImg: disPho
                },
                {
                    title: "杆基拍照",
                    photoImg: disPho
                },
                {
                    title: "全塔拍照",
                    photoImg: disPho
                },
                {
                    title: "塔头拍照",
                    photoImg: disPho
                },
                {
                    title: "大号侧同拍照",
                    photoImg: disPho
                },
                {
                    title: "小号侧同拍照",
                    photoImg: disPho
                }
            ],
            type_arr: {}
        }
    },
    mounted() {
		
    },
    methods: {
		// 头部两侧按钮点击事件
		headerClick(e){
			this.show=true;
		},
		// 初始化缺陷数据
        initQuanxian(e){
            this.type_arr = e;
        },
		// 八大缺陷的点击事件
		quexianClick(e){
            // this.alertMeg()
            this.$router.push({
				name:'xljx_quexianList',
				query : {
                    name: e.allName,
                    flag: e.FLAG,
                    defectType: e.index,
					towerId: this.$route.query.cmTowerId,
					punchtype: this.$route.query.punchtype,
					lineId: this.$route.query.lineId,
					lineName: this.$route.query.lineName,
					towerName: this.$route.query.towerName,
					taskId: this.$route.query.taskId,
					lineTowerId:this.$route.query.lineTowerId,
                    towerStatus: this.$route.query.towerStatus,
                    towerTaskId: this.$route.query.towerTaskId,
                    index: this.$route.query.index,
                    lineName:this.$route.query.lineName,
					towerName:this.$route.query.towerName
	        	}
			})
		},
		alertMeg(){
			Dialog.alert({
				message: '只有接任务后，才可以继续接下来的操作'
			}).then(() => {
				// on close
			});
		},
        goYhList() {
        	this.$router.push({
				name:'xljx_yinhuanList',
				query : {
					towerId:this.$route.query.cmTowerId,
					punchtype:this.$route.query.punchtype,
					lineId:this.$route.query.lineId,
					lineName:this.$route.query.lineName,
					towerName:this.$route.query.towerName,
					taskId :this.$route.query.taskId,
					lineTowerId :this.$route.query.lineTowerId,
                    towerTaskId:this.$route.query.towerTaskId,
                    towerStatus: this.$route.query.towerStatus,
                    gantaStatus:this.$route.query.gantaStatus
	        	}
			})
        },
        goClArea() {
        		this.alertMeg()
//          this.$router.push('/xljx_ceLiang');
        },
        //接受任务
        receiveTask() {
        	var params ={
        		acceptTask:1,//1表示接单
				towerTaskId : this.$route.query.towerTaskId
			}
			callData('/jxtaskServer/JxTowerTask/updateJdUser', 'put', params).then(res => {
				Toast(res.data);
				if(res.success){
					const query = this.$route.query;
                    query.router = 'xljx_allowPhotos'
                    query.towerStatus = 1
					this.$router.push({
						name:'xljx_allowPhotos',
						query:query
					})
				}
			})
        },
        prompt() {
            this.alertMeg()
        }
    }
}
</script>
